-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dashboards and charts): editable tiles | slottable menu items #1758
Conversation
ee386d3
to
e20f568
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to review.
e20f568
to
39d5b82
Compare
@@ -46,18 +46,24 @@ const overrideTimeframe: Ref<Timeframe> = computed(() => { | |||
return relativePeriod | |||
}) | |||
const options = computed<ProviderProps>(() => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a type error here that's somehow getting past CI... 🤔
No overload matches this call.
Overload 1 of 2, '(getter: ComputedGetter<Partial<{ description: string; containerTitle: string; refreshInterval: number; datasource: "advanced" | "basic"; dimension: "api_product" | "api_product_version" | "control_plane" | ... 9 more ... | "iso_code"; ... 8 more ...; percentileLatency: boolean; }> & Omit<...>>, debugOptions?: DebuggerOptions | undefined): ComputedRef<...>', gave the following error.
Type '"advanced" | "basic" | "ai"' is not assignable to type '"advanced" | "basic" | undefined'.
Type '"ai"' is not assignable to type '"advanced" | "basic" | undefined'.
Overload 2 of 2, '(options: WritableComputedOptions<Partial<{ description: string; containerTitle: string; refreshInterval: number; datasource: "advanced" | "basic"; dimension: "api_product" | "api_product_version" | "control_plane" | ... 9 more ... | "iso_code"; ... 8 more ...; percentileLatency: boolean; }> & Omit<...>, Partial<...> & Omit<...>>, debugOptions?: DebuggerOptions | undefined): WritableComputedRef<...>', gave the following error.
Argument of type '() => { datasource: "advanced" | "basic" | "ai"; overrideTimeframe: Timeframe; tz: string; additionalFilter: ExploreFilter[]; longCardTitles: boolean | undefined; containerTitle: string | undefined; description: string | undefined; percentileLatency: boolean | undefined; refreshInterval: number; queryReady: boolean; }' is not assignable to parameter of type 'WritableComputedOptions<Partial<{ description: string; containerTitle: string; refreshInterval: number; datasource: "advanced" | "basic"; dimension: "api_product" | "api_product_version" | "control_plane" | ... 9 more ... | "iso_code"; ... 8 more ...; percentileLatency: boolean; }> & Omit<...>, Partial<...> & Omit<....'.ts-plugin(2769)
MetricsProvider.vue.d.ts(67, 5): The expected type comes from property 'datasource' which is declared here on type 'Partial<{ description: string; containerTitle: string; refreshInterval: number; datasource: "advanced" | "basic"; dimension: "api_product" | "api_product_version" | "control_plane" | ... 9 more ... | "iso_code"; ... 8 more ...; percentileLatency: boolean; }> & Omit<...>'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's from updates to analytics-utilities which introduced the ai
datasource, while the provider props in metrics provider defines datasource property like so: datasource?: "basic" | "advanced" | undefined;
Not sure if my change is the right one, or we should add ai
to the acceptable datasources in MetricsProvider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. I'll make a note to look at this later. I think this is the fault of the schema; it shouldn't allow setting ai
as a datasource for metric cards. I think what you have for now is fine.
- add new edit-tile event to dashboard renderer - forward go to explore to analytics chart through tile definition - add new editable property to tile definition that will add an "edit" item to the analytics chart kebab menu. Clicking on edit, will emit an @edit-tile event with the entire GridTile<T> object containing the tile layout, definition and index
39d5b82
to
b103fc2
Compare
@@ -55,6 +55,14 @@ const allowCsvExport = { | |||
type: 'boolean', | |||
} as const | |||
|
|||
const goToExplore = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think either of these properties should be exposed in the schema. The things in the schema are eventually going to be part of the public API for dashboards; there's no case where an end user should be able to directly configure these props.
I'd recommend:
editable
is exposed viacontext
. I think it's OK (especially for now) to say that either all tiles are editable or none are.goToExplore
is probably a base URL that's configured via the analytics bridge, and the query data provider calculates the final URL to hand toAnalyticsChart
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the dashboard know if the tiles should have go to explore or not? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming some tiles will support it while some would not. EG TopNTable doesn't map to anything in Explore, same with "slottable" tiles
@@ -46,18 +46,24 @@ const overrideTimeframe: Ref<Timeframe> = computed(() => { | |||
return relativePeriod | |||
}) | |||
const options = computed<ProviderProps>(() => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. I'll make a note to look at this later. I think this is the fault of the schema; it shouldn't allow setting ai
as a datasource for metric cards. I think what you have for now is fine.
bd46c63
to
231a753
Compare
@@ -3,7 +3,7 @@ | |||
<BaseAnalyticsChartRenderer | |||
:chart-options="chartOptions" | |||
:context="context" | |||
:editable="editable" | |||
:editable="context.editable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're already passing in context
-- no need for the extra prop. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -61,7 +61,7 @@ const componentData = computed(() => { | |||
queryReady: props.queryReady, | |||
chartOptions: props.definition.chart, | |||
height: props.height - PADDING_SIZE * 2, | |||
editable: props.definition.editable, | |||
editable: props.context.editable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to pass in this prop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it's still there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, my bad. I got rid of using the prop, forgot to revert this line 😅
24443a5
@@ -59,10 +60,6 @@ const goToExplore = { | |||
type: 'string', | |||
} as const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove goToExplore
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -61,7 +61,7 @@ const componentData = computed(() => { | |||
queryReady: props.queryReady, | |||
chartOptions: props.definition.chart, | |||
height: props.height - PADDING_SIZE * 2, | |||
editable: props.definition.editable, | |||
editable: props.context.editable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it's still there...
Summary
https://konghq.atlassian.net/browse/MA-3367
go-to -explore
prop to analytics chart through tile definition@edit-tile
event